# api_routes.py
from fastapi import APIRouter, WebSocket
# from api.red_book_user_api import RedBookUserApi
# from api.xhs_sockets import websocket_server_instance

class APIRouteManager:

    def __init__(self):
        self.router = APIRouter()

    # def setup_user_routes(self):
    #     user_api = RedBookUserApi()
    #     self.router.add_api_route(
    #         "/api/user/add",
    #         user_api.create_user,
    #         methods=["POST"],
    #     )
    #     self.router.add_api_route(
    #         "/api/user/login",
    #         user_api.user_login,
    #         methods=["POST"],
    #     )
    #     self.router.add_api_route(
    #         "/api/user/info",
    #         user_api.user_info,
    #         methods=["GET"],
    #     )

    # def setup_websocket_route(self):
    #     async def websocket_endpoint(websocket: WebSocket):
    #         await websocket_server_instance.connect(websocket)
    #         try:
    #             while True:
    #                 data = await websocket.receive_text()
    #                 await websocket_server_instance.handle_message(websocket, data)
    #         except Exception as e:
    #             print(f"Error: {e}")
    #         finally:
    #             websocket_server_instance.disconnect(websocket)
    #
    #     self.router.add_api_websocket_route("/ws", websocket_endpoint)

    def get_router(self):
        # self.setup_user_routes()  # 用户路由
        # self.setup_websocket_route()  # WebSocket路由
        return self.router
